package com.ufgov.zc.client.zc.zcebrfq;import java.awt.BorderLayout;import java.awt.Color;import java.awt.Dimension;import java.awt.FlowLayout;import java.awt.Font;import java.awt.Window;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.io.BufferedWriter;import java.io.File;import java.io.FileOutputStream;import java.io.IOException;import java.io.OutputStream;import java.io.OutputStreamWriter;import java.io.Writer;import java.math.BigDecimal;import java.text.DateFormat;import java.text.SimpleDateFormat;import java.util.ArrayList;import java.util.Date;import java.util.HashMap;import java.util.Iterator;import java.util.List;import java.util.Map;import javax.swing.BorderFactory;import javax.swing.JComboBox;import javax.swing.JComponent;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JTabbedPane;import javax.swing.JTextArea;import javax.swing.JTextField;import javax.swing.border.TitledBorder;import javax.swing.event.TableModelEvent;import javax.swing.event.TableModelListener;import org.apache.log4j.Logger;import com.ufgov.smartclient.component.JDateTextField;import com.ufgov.smartclient.component.table.fixedtable.JPageableFixedTable;import com.ufgov.zc.client.common.AsOptionMeta;import com.ufgov.zc.client.common.BillElementMeta;import com.ufgov.zc.client.common.LangTransMeta;import com.ufgov.zc.client.common.ListCursor;import com.ufgov.zc.client.common.ParentWindowAware;import com.ufgov.zc.client.common.ServiceFactory;import com.ufgov.zc.client.common.WorkEnv;import com.ufgov.zc.client.common.converter.zc.ZcXunjiaDetailToTableModelConverter;import com.ufgov.zc.client.component.JFuncToolBar;import com.ufgov.zc.client.component.JTablePanel;import com.ufgov.zc.client.component.button.DelayBidButton;import com.ufgov.zc.client.component.button.EditButton;import com.ufgov.zc.client.component.button.ExitButton;import com.ufgov.zc.client.component.button.FuncButton;import com.ufgov.zc.client.component.button.HelpButton;import com.ufgov.zc.client.component.button.NextButton;import com.ufgov.zc.client.component.button.OpenBidButton;import com.ufgov.zc.client.component.button.PreviousButton;import com.ufgov.zc.client.component.button.RejectBidButton;import com.ufgov.zc.client.component.button.SaveButton;import com.ufgov.zc.client.component.button.TraceButton;import com.ufgov.zc.client.component.button.XunJiaDetailPrintPreviewButton;import com.ufgov.zc.client.component.button.XunJiaTotalPrintPreviewButton;import com.ufgov.zc.client.component.button.zc.CommonButton;import com.ufgov.zc.client.component.table.BeanTableModel;import com.ufgov.zc.client.component.table.celleditor.DateCellEditor;import com.ufgov.zc.client.component.table.cellrenderer.DateCellRenderer;import com.ufgov.zc.client.component.table.codecelleditor.AsValComboBoxCellEditor;import com.ufgov.zc.client.component.table.codecellrenderer.AsValCellRenderer;import com.ufgov.zc.client.component.ui.fieldeditor.AbstractFieldEditor;import com.ufgov.zc.client.component.zc.AbstractMainSubEditPanel;import com.ufgov.zc.client.component.zc.fieldeditor.AsValFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.CompanyFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.DateFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.JDateTimeTextField;import com.ufgov.zc.client.component.zc.fieldeditor.MoneyFieldEditor;import com.ufgov.zc.client.component.zc.fieldeditor.TextFieldEditor;import com.ufgov.zc.client.util.NumUtil;import com.ufgov.zc.client.util.SwingUtil;import com.ufgov.zc.client.util.freemark.StringUtil;import com.ufgov.zc.client.zc.ButtonStatus;import com.ufgov.zc.client.zc.FreemarkUtil;import com.ufgov.zc.client.zc.WordFileUtil;import com.ufgov.zc.client.zc.ZcUtil;import com.ufgov.zc.client.zc.activeztb.TbDocService;import com.ufgov.zc.client.zc.eval.result.ZcEbReportDialog;import com.ufgov.zc.client.zc.ztb.ChangeRMB;import com.ufgov.zc.common.system.RequestMeta;import com.ufgov.zc.common.system.constants.ZcElementConstants;import com.ufgov.zc.common.system.constants.ZcSettingConstants;import com.ufgov.zc.common.system.dto.ElementConditionDto;import com.ufgov.zc.common.system.model.AsFile;import com.ufgov.zc.common.system.util.DigestUtil;import com.ufgov.zc.common.system.util.ObjectUtil;import com.ufgov.zc.common.zc.model.RfqSinupPack;import com.ufgov.zc.common.zc.model.SupplierPriceDetail;import com.ufgov.zc.common.zc.model.ZcBulWModel;import com.ufgov.zc.common.zc.model.ZcEbBullietinZBTZ;import com.ufgov.zc.common.zc.model.ZcEbEvalReport;import com.ufgov.zc.common.zc.model.ZcEbNotice;import com.ufgov.zc.common.zc.model.ZcEbPackPlan;import com.ufgov.zc.common.zc.model.ZcEbProj;import com.ufgov.zc.common.zc.model.ZcEbRfqPack;import com.ufgov.zc.common.zc.model.ZcEbXunJiaBaoJia;import com.ufgov.zc.common.zc.model.ZcHtModel;import com.ufgov.zc.common.zc.model.ZcXmcgHt;import com.ufgov.zc.common.zc.model.ZcXunJiaDetail;import com.ufgov.zc.common.zc.model.ZcXunJiaSummary;import com.ufgov.zc.common.zc.publish.IZcEbBaseServiceDelegate;import com.ufgov.zc.common.zc.publish.IZcEbEvalServiceDelegate;import com.ufgov.zc.common.zc.publish.IZcEbNoticeServiceDelegate;import com.ufgov.zc.common.zc.publish.IZcEbProjServiceDelegate;import com.ufgov.zc.common.zc.publish.IZcEbXjbjServiceDelegate;import freemarker.template.Configuration;import freemarker.template.Template;/** * 等待开标界面 * @author Administrator * */public class ZcEbRfqEvalPackPanel extends AbstractMainSubEditPanel implements ParentWindowAware {  private Window parentWindow;  private static final long serialVersionUID = -7096834819505641043L;  private static final Logger logger = Logger.getLogger(ZcEbRfqEvalPackPanel.class);  private IZcEbBaseServiceDelegate zcEbBaseServiceDelegate = (IZcEbBaseServiceDelegate) ServiceFactory.create(IZcEbBaseServiceDelegate.class,  "zcEbBaseServiceDelegate");  private IZcEbXjbjServiceDelegate zcebXjbjServiceDelegate = (IZcEbXjbjServiceDelegate) ServiceFactory.create(IZcEbXjbjServiceDelegate.class,  "zcebXjbjServiceDelegate");  private final IZcEbEvalServiceDelegate zcEbEvalServiceDelegate = (IZcEbEvalServiceDelegate) ServiceFactory.create(IZcEbEvalServiceDelegate.class,  "zcEbEvalServiceDelegate");  private IZcEbNoticeServiceDelegate zcEbNoticeServiceDelegate = (IZcEbNoticeServiceDelegate) ServiceFactory.create(IZcEbNoticeServiceDelegate.class,    "zcEbNoticeServiceDelegate");  public IZcEbProjServiceDelegate zcEbProjectServiceDelegate = (IZcEbProjServiceDelegate) ServiceFactory.create(IZcEbProjServiceDelegate.class,    "zcEbProjServiceDelegate");  private RequestMeta requestMeta = WorkEnv.getInstance().getRequestMeta();  private String compoId = "ZC_EB_RFQ";  private ZcEbRfqListPanel listPanel;    JTablePanel summaryTablePanel = null;  /**   * 功能按钮   */  private FuncButton saveButton = new SaveButton();  private FuncButton editButton = new EditButton();  private FuncButton exitButton = new ExitButton();  private FuncButton previousButton = new PreviousButton();  private FuncButton nextButton = new NextButton();  private FuncButton helpButton = new HelpButton();  private FuncButton openBidButton = new OpenBidButton();  //延期  private FuncButton delayButton = new DelayBidButton();  //废标  private FuncButton rejectBidButton = new RejectBidButton();  private FuncButton crtEvButton = new CommonButton("fcrtEv", "生成评审报告", null, false);  private FuncButton createNoticeButton = new CommonButton("fcreateNotice", "生成中标通知书", null, false);  private FuncButton crtBulButton = new CommonButton("fcrtBul", "生成中标结果公告", null, false);  //  private FuncButton fcrtHtButton = new CommonButton("fcrtHt", "生成合同", null, false);  // 工作流流程跟踪  private FuncButton traceButton = new TraceButton();  private FuncButton xunJiaTotalPrintPreviewButton = new XunJiaTotalPrintPreviewButton();  private FuncButton xunJiaDetailPrintPreviewButton = new XunJiaDetailPrintPreviewButton();  private ZcEbRfqPack oldZcEbRfqPack;  JTabbedPane tabPane = new JTabbedPane();  private JPanel _subPanel;  private ZcEbRfqEvalPackPanel self = this;  private String pageStatus = ZcSettingConstants.PAGE_STATUS_BROWSE;  private String tabStatus;  private ArrayList<ButtonStatus> btnStatusList = new ArrayList<ButtonStatus>();  TextFieldEditor remarkEditor;  private final String sumTabTitle = "供应商询价汇总表";  private final String listTabTitle = "供应商询价一览表";  private static final String CloseDeal = "成交";  private static final String NotCloseDeal = "未成交";  private boolean isCanOpen = false;  private String isCar;  TbDocService tbs = null;  HashMap<String, JPanel> sumarryPanelCach = new HashMap<String, JPanel>();  HashMap<String, JComboBox> isCloseDealComboxMap = new HashMap<String, JComboBox>();  private JTextArea rfqTeamArea = new JTextArea();  private ListCursor listCursor;  private List<ZcEbXunJiaBaoJia> xjbjList;  private List<ZcXunJiaSummary> xjSummaryList = new ArrayList<ZcXunJiaSummary>();  private Map<String, Date> tbDates = new HashMap<String, Date>();  private List<ZcXunJiaDetail> xjdList;  private DateFormat ds = new SimpleDateFormat("yyyy年MM月dd日");  private MoneyFieldEditor winPriceEditor = new MoneyFieldEditor("成交报价", "winBidSum");  private TextFieldEditor winSupplierEditor = new TextFieldEditor("成交供应商", "winBidProviderName");  public ZcEbRfqEvalPackPanel(ListCursor listCursor, String tabStatus, ZcEbRfqListPanel listPanel) {    super(ZcEbRfqPack.class, listPanel.getBillElementMeta());    this.listCursor = listCursor;    this.listPanel = listPanel;    this.workPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "询价开标管理",    TitledBorder.CENTER, TitledBorder.TOP, new Font("宋体", Font.BOLD, 15), Color.BLUE));    this.colCount = 3;    this.tabStatus = tabStatus;    pageStatus = ZcSettingConstants.PAGE_STATUS_BROWSE;    requestMeta.setCompoId(compoId);    init();    initIsCar();    refreshData(true);    updateFieldEditorsEditable();  }  private void initIsCar() {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    ElementConditionDto dto = new ElementConditionDto();    dto.setZcText0(zcEbRfqPack.getProjCode());    dto.setPackCode(zcEbRfqPack.getPackCode());    dto.setStatus("done");    xjbjList = zcebXjbjServiceDelegate.getXunJiaBaoJiaByCondition(dto, requestMeta);    dto.setProjCode(zcEbRfqPack.getProjCode());    /**     * 获取询价报价的明细     */    xjdList = listPanel.zcEbRfqServiceDelegate.getXunjiaDetaiList(dto, requestMeta);    if (xjdList == null) {      xjdList = new ArrayList<ZcXunJiaDetail>();    }    Map para = new HashMap();    para.put("projCode", zcEbRfqPack.getProjCode());    para.put("packCode", zcEbRfqPack.getPackCode());    List<Map> info = zcEbBaseServiceDelegate.queryDataForList("ZC_EB_XUNJIA_BAOJIA.selectSuppSp", para, requestMeta);    if (info != null) {      for (int i = 0; i < info.size(); i++) {        tbDates.put(info.get(i).get("supplier_code").toString(), (Date) info.get(i).get("sp_date"));      }    }    collectSameProviderPrice(zcEbRfqPack);    zcEbRfqPack.setSignUpedProviderNum(this.xjSummaryList.size() + "");    isCar = (String) zcEbBaseServiceDelegate.queryObject("ZcEbRfq.isCar", zcEbRfqPack.getPackCode(), requestMeta);    if ((!"Y".equals(isCar) && xjSummaryList.size() < ZcSettingConstants.XUNJIA_SUPPLIER_LEAST_NUM)      || ("Y".equals(isCar) && xjSummaryList.size() < ZcSettingConstants.XUNJIA_SUPPLIER_LEAST_NUM_FORCE)) {      isCanOpen = false;    } else {      isCanOpen = true;    }  }  private void refreshData(boolean isFreshWorkPanel) {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    if (null == zcEbRfqPack.getOpenBidStatus() || ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_WAIT.equals(zcEbRfqPack.getOpenBidStatus())    || ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_AUDIT_CONSTRAINT.equals(zcEbRfqPack.getOpenBidStatus())    || ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_AUDIT_TRASH.equals(zcEbRfqPack.getOpenBidStatus())) {      Map<String, String> map = new HashMap<String, String>();      map.put("projCode", zcEbRfqPack.getProjCode());      map.put("packCode", zcEbRfqPack.getPackCode());      ZcEbPackPlan plan = (ZcEbPackPlan) zcEbBaseServiceDelegate.queryObject("ZcEbPlan.getZcEbPackPlanByMap", map, requestMeta);      if (plan != null) {        zcEbRfqPack.setPlanOpenBidDate(plan.getOpenBidTime());        zcEbRfqPack.setBidEndTime(plan.getBidEndTime());        zcEbRfqPack.setNd(requestMeta.getSvNd());      }      setDefaultValue(zcEbRfqPack);    }    if (null != zcEbRfqPack.getRfqTeamOpinion()) {      rfqTeamArea.setText(zcEbRfqPack.getRfqTeamOpinion());    }    if (ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_WAIT.equals(zcEbRfqPack.getOpenBidStatus())) {      pageStatus = ZcSettingConstants.PAGE_STATUS_EDIT;      zcEbRfqPack.setExecuteDate(requestMeta.getSysDate());    } else {      pageStatus = ZcSettingConstants.PAGE_STATUS_BROWSE;    }    this.setEditingObject(zcEbRfqPack);    if (isFreshWorkPanel) {      refreshWorkPanel();    }    updateFieldEditorsEditable();    setButtonStatus();    //按钮的控制先通过页面和单据的状态，然后通过工作流控制    setOldObject();  }  private void setDefaultValue(ZcEbRfqPack zcEbRfqPack) {    pageStatus = ZcSettingConstants.PAGE_STATUS_EDIT;    //新增单据询价标段的状态为‘等待开标’    if (zcEbRfqPack.getRfqCode() == null) {      zcEbRfqPack.setExecuteDate(requestMeta.getSysDate());      zcEbRfqPack.setNd(requestMeta.getSvNd());    }  }  private void refreshWorkPanel() {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    String info = "";    if (_subPanel == null) {      _subPanel = new JPanel(new BorderLayout());    } else {      _subPanel.removeAll();    }    //错误的逻辑 ----如果已经开标成功、或者报价商家多于3家，或者进行了强制开标，且报价商家大于1家，都可以显示    //只判断状态如果是开标的，就是显示结果,申请废弃报价的也显示结果    if (ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_SUCCESS.equals(zcEbRfqPack.getOpenBidStatus())      || ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_AUDIT_TRASH.equals(zcEbRfqPack.getOpenBidStatus())      || ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_CRAP.equals(zcEbRfqPack.getOpenBidStatus())) {      this.tabPane = new JTabbedPane();      this.tabPane.addTab(this.sumTabTitle, makeSummaryListPanel());      this.tabPane.addTab(this.listTabTitle, makeEnquiryListTabPane(zcEbRfqPack));      _subPanel.add(tabPane, BorderLayout.CENTER);    } else {      if (!isCanOpen) {        info = "当前报价商家不足，不允许查看报价商家信息...";      } else {        info = "尚未开标，无法查看详细信息...";      }      this.tabPane = new JTabbedPane();      JPanel panel = new JPanel();      panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), info, TitledBorder.CENTER, TitledBorder.TOP, new Font(      "宋体", Font.BOLD, 15), Color.RED));      this.tabPane.add("供应商报价信息", panel);      _subPanel.add(tabPane, BorderLayout.CENTER);    }    _subPanel.validate();//    this.validate();  }  public List<AbstractFieldEditor> createFieldEditors() {    final List<AbstractFieldEditor> editorList = new ArrayList<AbstractFieldEditor>();    TextFieldEditor editor0;    editor0 = new TextFieldEditor("项目编号", "projCode");    editorList.add(editor0);    editor0 = new TextFieldEditor(LangTransMeta.translate(ZcElementConstants.FIELD_TRANS_PACK_NAME), "packName");    editorList.add(editor0);    CompanyFieldEditor editor1 = new CompanyFieldEditor(LangTransMeta.translate(ZcElementConstants.FIELD_TRANS_ZC_CO_NAME), "coCode");    editorList.add(editor1);    AsValFieldEditor editor3 = new AsValFieldEditor("报价状态", "openBidStatus", ZcElementConstants.VS_ZC_EB_RFQ_OPEN_BID_STATUS);    editorList.add(editor3);    editor0 = new TextFieldEditor("报价供应商个数", "signUpedProviderNum");    editorList.add(editor0);    editor0 = new TextFieldEditor("报价延期/失败原因", "reason");    editorList.add(editor0);    editorList.add(winSupplierEditor);    editorList.add(winPriceEditor);    DateFieldEditor editor5 = new DateFieldEditor("报价截止时间", "bidEndTime", DateFieldEditor.TimeTypeH24);    editorList.add(editor5);    editor5 = new DateFieldEditor("报价开启时间", "openBidDate", DateFieldEditor.TimeTypeH24);    editorList.add(editor5);    editor0 = new TextFieldEditor("经办人", "creator");    editorList.add(editor0);    editor5 = new DateFieldEditor("询价单创建时间", "createDate", DateFieldEditor.TimeTypeH24);    editorList.add(editor5);    editor3 = new AsValFieldEditor("询价单审核状态", "status", ZcElementConstants.VS_ZC_EB_RFQ_STATUS);//    editorList.add(editor3);    return editorList;  }  public JComponent createSubBillPanel() {    if (_subPanel == null) {      _subPanel = new JPanel(new BorderLayout());    } else {      _subPanel.removeAll();    }    return _subPanel;  }  //创建询价汇总面板  private JPanel makeSummaryListPanel() {    JPanel p = new JPanel(new BorderLayout());    p.add(createSummaryTablePanel(), BorderLayout.CENTER);    return p;  }  /**   *   * @Description: 根据供应商的报价明细，按每个供应商汇总生成汇总结果。  * @return void 返回类型  * @since 1.0   */  private void collectSameProviderPrice(ZcEbRfqPack zcEbRfqPack) {    ZcXunJiaSummary sum = null;    xjSummaryList.clear();    //如果没有中标人，那么暂时将暂时中标人设置为一个不可能存在的值    String winnerCode = zcEbRfqPack.getWinBidProviderCode() == null ? "##@##" : zcEbRfqPack.getWinBidProviderCode();    /**     * 先按供应商进行分组，同一个供应商的报价明细分到一组，然后汇总每个供应商报价的总和。     */    for (int n = 0; n < xjbjList.size(); n++) {      ZcEbXunJiaBaoJia bj = xjbjList.get(n);      sum = new ZcXunJiaSummary();      List<ZcXunJiaDetail> xunJiaDetailList = new ArrayList<ZcXunJiaDetail>();      for (int m = 0; m < xjdList.size(); m++) {        ZcXunJiaDetail xj1 = xjdList.get(m);        if (bj.getProjCode().equals(xj1.getProjCode()) && bj.getSupplierCode().equals(xj1.getProviderCode())) {          xunJiaDetailList.add(xj1);        }      }      sum.setXunJiaDetailList(xunJiaDetailList);      //询价报价存在多个明细的话：只要有一个明细有现货，汇总结果就是有现货；供货时间取最早的供货时间      String haveXianhuo = "N";      Date gonghuoDate = xunJiaDetailList.get(0).getGongHuoDate();      BigDecimal totalPrice = new BigDecimal(0.0);      for (ZcXunJiaDetail detail : xunJiaDetailList) {        if ("Y".equals(detail.getHaveXianHuo())) {          haveXianhuo = "Y";        }        if (gonghuoDate != null) {          if (detail.getGongHuoDate() != null && gonghuoDate.after(detail.getGongHuoDate())) {            gonghuoDate = detail.getGongHuoDate();          }        }        totalPrice = totalPrice.add(detail.getSpTotalSum());      }      sum.setHaveXianHuo(haveXianhuo);      sum.setGongHuoDate(gonghuoDate);      sum.setIsClosedDeal(winnerCode.equals(bj.getSupplierCode()) ? "Y" : "N");      sum.setProviderCode(bj.getSupplierCode());      sum.setProviderName(bj.getSupplierName());      sum.setTotalPrice(totalPrice);      sum.setLinkMan(bj.getManager());      sum.setLinkTel(bj.getPhone());      sum.setRemark(bj.getRemark());      sum.setBjDate(bj.getBjDate());      xjSummaryList.add(sum);    }  }  //填充询价汇总面板  private JTablePanel createSummaryTablePanel() {    summaryTablePanel = new JTablePanel();    summaryTablePanel.init();    summaryTablePanel.setTableModel(ZcXunjiaDetailToTableModelConverter.convertSummaryTableData(xjSummaryList,      ZcXunjiaDetailToTableModelConverter.getSummaryInfo()));    summaryTablePanel.getSearchBar().setVisible(false);    ZcUtil.translateColName(summaryTablePanel.getTable(), ZcXunjiaDetailToTableModelConverter.getSummaryInfo());    setXunJiaSummaryTableProperty();    return summaryTablePanel;  }  private void setXunJiaSummaryTableProperty() {    SwingUtil.setTableCellEditor(summaryTablePanel.getTable(), "IS_CLOSED_DEAL", new AsValComboBoxCellEditor("VS_Y/N"));    SwingUtil.setTableCellRenderer(summaryTablePanel.getTable(), "IS_CLOSED_DEAL", new AsValCellRenderer("VS_Y/N"));    SwingUtil.setTableCellEditor(summaryTablePanel.getTable(), "HAVE_XIAN_HUO", new AsValComboBoxCellEditor("VS_Y/N"));    SwingUtil.setTableCellRenderer(summaryTablePanel.getTable(), "HAVE_XIAN_HUO", new AsValCellRenderer("VS_Y/N"));    SwingUtil.setTableCellEditor(summaryTablePanel.getTable(), "GONG_HUO_DATE", new DateCellEditor());    SwingUtil.setTableCellRenderer(summaryTablePanel.getTable(), "BJ_DATE", new DateCellRenderer(DateCellRenderer.SS));    addSummaryTableLisenter(summaryTablePanel.getTable());  }  private void addSummaryTableLisenter(final JPageableFixedTable table) {    final BeanTableModel model = (BeanTableModel) (table.getModel());    model.addTableModelListener(new TableModelListener() {      public void tableChanged(TableModelEvent e) {        if (e.getColumn() >= 0 && ("IS_CLOSED_DEAL".equals(model.getColumnIdentifier(e.getColumn())))) {          int k = table.getSelectedRow();          if (k < 0)            return;          ZcXunJiaSummary item = (ZcXunJiaSummary) (model.getBean(table.convertRowIndexToModel(k)));          summaryTableChanged(item);          model.fireTableRowsUpdated(k, k);        }      }    });  }  /**   * 如果修改了成交商家，那么：   * 1、将当前选中成交商家和最低价商家比较，如果当前选中的商家不是最低价最早供货商，则给予提示；   * 2、需要刷新本身询价汇总信息面板：将别的已成交商家修改为未成交商家；   * 3、刷新所有商家报价一览表：将新成交的商家修改为成交，而将别的商家都置为未成交；   * 4、根据以上改变的结果更新数据库；   */  public void summaryTableChanged(ZcXunJiaSummary curr) {    ZcXunJiaSummary lowest = getBetterProvider();    if ("Y".equals(curr.getIsClosedDeal())) {      if (curr.getProviderCode() != null && !curr.getProviderCode().equals(lowest.getProviderCode())) {        int opt = JOptionPane.showConfirmDialog(this, "您好，当前选中的商家不是最低报价商家，或相同报价但不是最快供货商家,是否继续？", "确认", JOptionPane.YES_NO_OPTION);        this.doExecuteSelect(opt, curr);      } else {        this.doExecuteSelect(JOptionPane.YES_OPTION, curr);      }    } else {    }  }  private void doExecuteSelect(int opt, ZcXunJiaSummary curr) {    ZcXunJiaSummary item = null;    if (opt == JOptionPane.YES_OPTION) {      JPageableFixedTable table = summaryTablePanel.getTable();      BeanTableModel model = (BeanTableModel) table.getModel();      for (int i = 0; i < table.getRowCount(); i++) {        item = (ZcXunJiaSummary) model.getBean(i);        if (item.getProviderCode() != null && !item.getProviderCode().equals(curr.getProviderCode())) {          item.setIsClosedDeal("N");        }      }      model.fireTableRowsUpdated(0, table.getRowCount() - 1);      updateToDataBase(curr);      updateSummayrPanel(curr);      updateMainPanel(curr);    } else {      //恢复原来的值      JPageableFixedTable table = summaryTablePanel.getTable();      BeanTableModel model = (BeanTableModel) table.getModel();      int k = table.getSelectedRow();      if (k < 0) {        return;      }      item = (ZcXunJiaSummary) (model.getBean(table.convertRowIndexToModel(k)));      item.setIsClosedDeal("N");      model.fireTableRowsUpdated(k, k);    }  }  private void updateMainPanel(ZcXunJiaSummary curr) {    // TODO Auto-generated method stub    updateToDataBase(curr);  }  private boolean toCheckHavedSelectProvider() {    boolean res = true;    JPageableFixedTable table = summaryTablePanel.getTable();    BeanTableModel model = (BeanTableModel) table.getModel();    for (int i = 0; i < table.getRowCount(); i++) {      ZcXunJiaSummary item = (ZcXunJiaSummary) (model.getBean(table.convertRowIndexToModel(i)));      res = res && ("Y".equals(item.getIsClosedDeal()) ? true : false);    }    return res;  }  /**   * 将修改后的结果同步到数据库中   * @param 中标供应商   */  private void updateToDataBase(ZcXunJiaSummary winner) {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    zcEbRfqPack.setWinBidProviderCode(winner.getProviderCode());    zcEbRfqPack.setWinBidProviderName(winner.getProviderName());    zcEbRfqPack.setWinBidSum(winner.getTotalPrice());    this.setEditingObject(zcEbRfqPack);//    this.repaint();  }  private void updateSummayrPanel(ZcXunJiaSummary winner) {    String key = "";    Iterator<String> it = this.isCloseDealComboxMap.keySet().iterator();    while (it.hasNext()) {      key = it.next();      if (key.equals(winner.getProviderCode())) {        this.isCloseDealComboxMap.get(key).setSelectedItem(CloseDeal);      } else {        this.isCloseDealComboxMap.get(key).setSelectedItem(NotCloseDeal);      }    }  }  /*   * 获取成交的供应商，如果没有指定，默认获取最低价格,最早提交报价的供应商   */  private ZcXunJiaSummary getBetterProvider() {    ZcXunJiaSummary minBaoJia = new ZcXunJiaSummary();    for (int i = 0; i < this.xjSummaryList.size(); i++) {      ZcXunJiaSummary bj = (ZcXunJiaSummary) this.xjSummaryList.get(i);      if (i == 0 || minBaoJia.getTotalPrice() == null) {        minBaoJia = bj;        continue;      }      //比较价格      if (minBaoJia.getTotalPrice().compareTo(bj.getTotalPrice()) == 1) {        minBaoJia = bj;      } else if (minBaoJia.getTotalPrice().compareTo(bj.getTotalPrice()) == 0) {        //比较日期        if (minBaoJia.getGongHuoDate() != null && bj.getGongHuoDate() != null && minBaoJia.getGongHuoDate().after(bj.getGongHuoDate())) {          minBaoJia = bj;        }      }    }    return minBaoJia;  }  //创建询价供应商报价详细一览面板  private JTabbedPane makeEnquiryListTabPane(ZcEbRfqPack zcEbRfqPack) {    JTabbedPane tabPane = new JTabbedPane();    if (this.xjSummaryList != null && this.xjSummaryList.size() > 0) {      RfqSinupPack spp = null;      ZcXunJiaSummary sp = null;      String title = null;      JPanel p = null;      String spCode = null;      String totalPrice = null;      List<ZcXunJiaDetail> detailsForCurr = null;      for (int i = 0; i < this.xjSummaryList.size(); i++) {        sp = (ZcXunJiaSummary) this.xjSummaryList.get(i);        spCode = sp.getProviderCode();        detailsForCurr = new ArrayList<ZcXunJiaDetail>();        //找到当前供应商的detail        for (int j = 0; j < xjdList.size(); j++) {          if (spCode.equals(xjdList.get(j).getProviderCode())) {            detailsForCurr.add(xjdList.get(j));          }        }        totalPrice = this.getTotalMoney(spCode, detailsForCurr);        title = ZcUtil.substring(sp.getProviderName(), 16, "...") + "(总价:" + totalPrice + ")";        p = new JPanel(new BorderLayout());        spp = new RfqSinupPack();        spp.setProviderCode(sp.getProviderCode());        spp.setProviderName(sp.getProviderName());        p.add(createTopInfoPanel(sp, spp, totalPrice, zcEbRfqPack), BorderLayout.NORTH);        p.add(createEnquiryTablePanel(spp, detailsForCurr), BorderLayout.CENTER);        tabPane.add(title, p);      }      this.getLowestPrice(xjSummaryList, zcEbRfqPack);    } else {      JPanel empty = new JPanel(new BorderLayout());      JLabel label = new JLabel("当前没有相关数据需要显示...");      label.setPreferredSize(new Dimension(300, 30));      empty.add(label, BorderLayout.CENTER);      tabPane.setLayout(new BorderLayout());      tabPane.add(empty, BorderLayout.CENTER);    }    return tabPane;  }  private JPanel createTopInfoPanel(ZcXunJiaSummary sp, RfqSinupPack signPack, String totalPrice, ZcEbRfqPack zcEbRfqPack) {    JPanel infoPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 2, 2));    infoPanel.add(new JLabel("供应商:"));    JTextField field = new JTextField();    field.setPreferredSize(new Dimension(200, 20));    field.setText(signPack.getProviderName());    field.setEditable(false);    infoPanel.add(field);    infoPanel.add(new JLabel("  总报价:"));    field = new JTextField();    field.setPreferredSize(new Dimension(120, 20));    field.setText(totalPrice);    field.setEditable(false);    infoPanel.add(field);    infoPanel.add(new JLabel("(元)  报价时间:"));    JTextField dField = new JDateTextField();    dField.setPreferredSize(new Dimension(120, 20));    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");    if (sp.getBjDate() != null) {      dField.setText(sdf.format(sp.getBjDate()));    } else {      dField.setText(null);    }    dField.setEditable(false);    dField.setEnabled(false);    infoPanel.add(dField);    infoPanel.add(new JLabel("  完成供货时间:"));    JTextField dField2 = new JTextField();    dField2.setPreferredSize(new Dimension(80, 20));    sdf = new SimpleDateFormat("yyyy-MM-dd");    if (sp.getGongHuoDate() != null) {      dField2.setText(sdf.format(sp.getGongHuoDate()));    } else {      dField2.setText("未提供...");    }    dField2.setEditable(false);    dField2.setEnabled(false);    infoPanel.add(dField2);    infoPanel.add(new JLabel("  成交状态:"));    JComboBox comb = makeComboBox(signPack.getProviderCode());    if (signPack.getProviderCode() != null && signPack.getProviderCode().equals(zcEbRfqPack.getWinBidProviderCode())) {      comb.setSelectedItem(CloseDeal);    } else {      comb.setSelectedItem(NotCloseDeal);    }    comb.setEnabled(false);    comb.setEditable(false);    infoPanel.add(comb);    return infoPanel;  }  private JComboBox makeComboBox(String combID) {    JComboBox comb = new JComboBox();    comb.setName(combID);    comb.addItem(CloseDeal);    comb.addItem(NotCloseDeal);    //将引用存起来，这样方便在汇总页中修改成交商家后，可以直接使用这里的引用对对应的对象进行update.    isCloseDealComboxMap.put(combID, comb);    return comb;  }  JTablePanel enquiryTablePanel = null;  private JTablePanel createEnquiryTablePanel(RfqSinupPack rfqSinupPack, List<ZcXunJiaDetail> xjdList) {    enquiryTablePanel = new JTablePanel();    enquiryTablePanel.init();    enquiryTablePanel.setTableModel(ZcXunjiaDetailToTableModelConverter.convertSubBiTableData(xjdList));    enquiryTablePanel.getSearchBar().setVisible(false);    ZcUtil.translateColName(enquiryTablePanel.getTable(), ZcXunjiaDetailToTableModelConverter.getBillDetailInfo());    setEnquiryTablePropety();    return enquiryTablePanel;  }  private void setEnquiryTablePropety() {    SwingUtil.setTableCellEditor(enquiryTablePanel.getTable(), "HAVE_XIAN_HUO", new AsValComboBoxCellEditor("VS_Y/N"));    SwingUtil.setTableCellRenderer(enquiryTablePanel.getTable(), "HAVE_XIAN_HUO", new AsValCellRenderer("VS_Y/N"));    SwingUtil.setTableCellEditor(enquiryTablePanel.getTable(), "GONG_HUO_DATE", new DateCellEditor());    AsValComboBoxCellEditor acbc = new AsValComboBoxCellEditor("V_SP_UNIT");    SwingUtil.setTableCellEditor(enquiryTablePanel.getTable(), "SP_UNIT", acbc);    SwingUtil.setTableCellRenderer(enquiryTablePanel.getTable(), "SP_UNIT", new AsValCellRenderer("V_SP_UNIT"));  }  private String getTotalMoney(String spCode, List<ZcXunJiaDetail> list) {    String result = null;    ZcXunJiaDetail detail = null;    BigDecimal sum = BigDecimal.valueOf(0);    for (int i = 0; i < list.size(); i++) {      detail = list.get(i);      if (spCode.equals(detail.getProviderCode()) && detail.getSpTotalSum() != null) {        sum = sum.add(detail.getSpTotalSum());      }    }    result = ChangeRMB.doChange(sum.toPlainString());    return result;  }  private void getLowestPrice(List<ZcXunJiaSummary> list, ZcEbRfqPack zcEbRfqPack) {    if (list.size() > 0) {      ZcXunJiaSummary lowestPrice = this.getMinPriceProvider(list);      zcEbRfqPack.setBidMinPriceProvider(lowestPrice.getProviderName());      zcEbRfqPack.setBidMinPrice(lowestPrice.getTotalPrice());    }  }  /**   * 获取最低价最早供货的供应商   * @param list   * @return   */  private ZcXunJiaSummary getMinPriceProvider(List list) {    ZcXunJiaSummary min = null;    for (int i = 0; i < list.size(); i++) {      ZcXunJiaSummary curr = (ZcXunJiaSummary) list.get(i);      if (min == null) {        min = curr;        continue;      }      if (curr.getTotalPrice() == null) {        curr.setTotalPrice(new BigDecimal("0"));      }      int compare = min.getTotalPrice().compareTo(curr.getTotalPrice());      if (compare > 0) {        min = curr;      } else if (compare == 0) {        if (min.getGongHuoDate() != null && curr.getGongHuoDate() != null) {          if (min.getGongHuoDate().after(curr.getGongHuoDate())) {            min = curr;          }        } else if (min.getGongHuoDate() == null && curr.getGongHuoDate() != null) {          min = curr;        }      }    }    return min;  }  protected void updateFieldEditorsEditable() {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    super.updateFieldEditors();    if (this.pageStatus.equals(ZcSettingConstants.PAGE_STATUS_EDIT)) {      for (AbstractFieldEditor fd : this.fieldEditors) {        if ("reason".equals(fd.getFieldName())          && (ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_DELAY.equals(zcEbRfqPack.getOpenBidStatus()) || ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_CRAP            .equals(zcEbRfqPack.getOpenBidStatus()))) {          fd.setEnabled(true);        } else {          fd.setEnabled(false);        }      }      rfqTeamArea.setEditable(true);      if(summaryTablePanel!=null){        summaryTablePanel.getTable().setEnabled(true);      }    } else if (this.pageStatus.equals(ZcSettingConstants.PAGE_STATUS_BROWSE)) {      for (AbstractFieldEditor fd : this.fieldEditors) {        fd.setEnabled(false);      }      rfqTeamArea.setEditable(false);            if(summaryTablePanel!=null){        summaryTablePanel.getTable().setEnabled(false);      }    }  }  /**   *   * @Description: 根据页面状态和单据状态  * @return void 返回类型  * @since 1.0   */  private void setButtonStatus() {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    setButtonStatus(zcEbRfqPack, requestMeta, listCursor);    /**     * 非工作流的按钮控制，有几个单据状态：1、等待开标 2、开标成功 3、申请废标、4、申请强制开标、5、废标     *      */    /**     * --------------------------------------------等待开标-------------------------------------------      */    //如果报价供应商大于等于正常开标家数，则将申请强开，和申请废弃，强开，屏蔽掉    if (ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_WAIT.equals(zcEbRfqPack.getOpenBidStatus()) && !isCanOpen) {      openBidButton.setVisible(false);      rejectBidButton.setVisible(true);      crtEvButton.setVisible(false);      crtBulButton.setVisible(false);      createNoticeButton.setVisible(false);      //      fcrtHtButton.setVisible(false);    }    //如果报价供应商大于等于正常开标家数，则将申请强开，和申请废弃，强开，屏蔽掉    if (isCanOpen && ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_WAIT.equals(zcEbRfqPack.getOpenBidStatus())) {      openBidButton.setVisible(true);      rejectBidButton.setVisible(false);      crtEvButton.setVisible(false);      crtBulButton.setVisible(false);      createNoticeButton.setVisible(false);      //      fcrtHtButton.setVisible(false);    }    /**     * --------------------------------------------延期-------------------------------------------      */    if (ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_DELAY.equals(zcEbRfqPack.getOpenBidStatus())) {      openBidButton.setVisible(false);      rejectBidButton.setVisible(true);      crtEvButton.setVisible(false);      crtBulButton.setVisible(false);      createNoticeButton.setVisible(false);      //      fcrtHtButton.setVisible(false);    }    /**     * --------------------------------------------开标成功-------------------------------------------      */    if (ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_SUCCESS.equals(zcEbRfqPack.getOpenBidStatus())) {      openBidButton.setVisible(false);      rejectBidButton.setVisible(false);//开标成功的，不能废标，只能废弃报价      crtEvButton.setVisible(true);      crtBulButton.setVisible(true);      createNoticeButton.setVisible(true);      //      fcrtHtButton.setVisible(true);    }    /**     * -------------------------------------------废标状态------------------------------------------      */    if (ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_CRAP.equals(zcEbRfqPack.getOpenBidStatus())) {      openBidButton.setVisible(false);      rejectBidButton.setVisible(false);      crtEvButton.setVisible(true);      crtBulButton.setVisible(false);      createNoticeButton.setVisible(false);      //      fcrtHtButton.setVisible(false);    }    if (this.btnStatusList.size() == 0) {      ButtonStatus bs = new ButtonStatus();      //修改按钮      bs.setButton(this.editButton);      bs.addPageStatus(ZcSettingConstants.PAGE_STATUS_BROWSE);      bs.addBillStatus(ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_DELAY);      bs.addBillStatus(ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_SUCCESS);      btnStatusList.add(bs);      //保存按钮      bs = new ButtonStatus();      bs.setButton(this.saveButton);      bs.addPageStatus(ZcSettingConstants.PAGE_STATUS_EDIT);      bs.addBillStatus(ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_SUCCESS);      bs.addBillStatus(ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_DELAY);      btnStatusList.add(bs);    }    String billStatus = zcEbRfqPack.getOpenBidStatus();    ZcUtil.setButtonEnable(this.btnStatusList, billStatus, this.pageStatus, this.compoId, zcEbRfqPack.getProcessInstId());  }  private void setOldObject() {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    this.oldZcEbRfqPack = (ZcEbRfqPack) ObjectUtil.deepCopy(zcEbRfqPack);  }  public void initToolBar(JFuncToolBar toolBar) {    toolBar.setModuleCode("ZC");    toolBar.setCompoId(compoId);        toolBar.add(editButton);    //    toolBar.add(saveButton);    toolBar.add(openBidButton);    //    toolBar.add(forceOpenBidButton);    //    toolBar.add(delayButton);    toolBar.add(rejectBidButton);    toolBar.add(crtEvButton);    //    toolBar.add(crtBulButton);    //    toolBar.add(createNoticeButton);    //    toolBar.add(fcrtHtButton);    toolBar.add(traceButton);    //    toolBar.add(xunJiaTotalPrintPreviewButton);    //    //    toolBar.add(xunJiaDetailPrintPreviewButton);    toolBar.add(previousButton);    toolBar.add(nextButton);    toolBar.add(exitButton);    toolBar.add(helpButton);        editButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doEdit();      }    });    saveButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doSave();      }    });    traceButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doTrace();      }    });    editButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doEdit();      }    });    openBidButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doOpenBid();      }    });    rejectBidButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doRejectBid();      }    });    delayButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doDelayBid();      }    });    crtEvButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doCreateEval();      }    });    createNoticeButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        autoCreatNotice();      }    });    crtBulButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doCreateBulW();      }    });    //    fcrtHtButton.addActionListener(new ActionListener() {    //    //      public void actionPerformed(ActionEvent e) {    //    //        doCreateHt();    //    //      }    //    //    });    exitButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doExit();      }    });    xunJiaTotalPrintPreviewButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doXunJiaTotalPrintPrevie();      }    });    xunJiaDetailPrintPreviewButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        doXunJiaDetailPrintPrevie();      }    });  }  private void doEdit() {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    this.pageStatus = ZcSettingConstants.PAGE_STATUS_EDIT;    updateFieldEditorsEditable();    setButtonStatus();    setButtonStatus(zcEbRfqPack, requestMeta, listCursor);  }  private void doOpenBid() {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    if (!isCanOpen) {      JOptionPane.showMessageDialog(this, "报名供应商不足，不满足开标条件...", "提示",      JOptionPane.INFORMATION_MESSAGE);      return;    }    try {      int r = checkBaojiaInfo(zcEbRfqPack.getProcessInstId() != null && zcEbRfqPack.getProcessInstId().compareTo(0L) > 0);      zcEbRfqPack.setExecuteDate(requestMeta.getSysDate());      if (r > 0) {        zcEbRfqPack.setOpenBidDate(requestMeta.getSysDate());        zcEbRfqPack.setOpenBidStatus(ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_SUCCESS);        zcEbRfqPack.setStatus(ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_SUCCESS);        for (int i = 0; i < zcEbRfqPack.getRfqSinupPackList().size(); i++) {          RfqSinupPack sinupPack = (RfqSinupPack) zcEbRfqPack.getRfqSinupPackList().get(i);          sinupPack.setOpenBidDate(requestMeta.getSysDate());          sinupPack.setOpenBidStatus(ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_SUCCESS);        }      } else if (r <= 0) {        zcEbRfqPack.setOpenBidDate(requestMeta.getSysDate());        zcEbRfqPack.setOpenBidStatus(ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_CRAP);        zcEbRfqPack.setStatus(ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_CRAP);        zcEbRfqPack.setReason("【废标原因】供应商投标金额超出最高限额");        zcEbRfqPack.setIsGoonAudit(ZcSettingConstants.RFQ_AGREE_TRASH_BID);      } else {        zcEbRfqPack.setOpenBidStatus(ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_AUDIT_CONSTRAINT);        zcEbRfqPack.setStatus(ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_AUDIT_CONSTRAINT);        zcEbRfqPack.setComment("【送审原因】投标供应商报价在最高限额与预算之间，请确定开标成交或废标");      }      ZcEbRfqPack afterBill = this.listPanel.zcEbRfqServiceDelegate.saveZcEbRfqPackFN(zcEbRfqPack, requestMeta);      setEditingObject(afterBill);      listCursor.setCurrentObject(afterBill);      this.refreshData(true);      listPanel.refreshCurrentTabData();      JOptionPane.showMessageDialog(this, "开标成功", "提示", JOptionPane.INFORMATION_MESSAGE);    } catch (Exception e) {      setEditingObject(oldZcEbRfqPack);      listCursor.setCurrentObject(oldZcEbRfqPack);      JOptionPane.showMessageDialog(this, "开标出错：\n" + e.getMessage(), "提示", JOptionPane.INFORMATION_MESSAGE);    }  }  /**   * 增加直接生成中标通知书 qmj20130515   */  private void autoCreatNotice() {    ZcEbNotice notice = createNotice();    if (isCreatedNotice(notice)) {      JOptionPane.showMessageDialog(this, "已经生成过中标通知书了!不需要重复生成！", "提示", JOptionPane.INFORMATION_MESSAGE);      return;    }    try {      String fileName = fillWordMod(notice);      String fileID = saveBulletinContent(fileName);      insertNotice(notice, fileID);      JOptionPane.showMessageDialog(this, "生成中标通知书成功", "提示", JOptionPane.INFORMATION_MESSAGE);    } catch (Exception e) {      e.printStackTrace();      JOptionPane.showMessageDialog(this, "生成中标通知书失败：\n" + e.getMessage(), "提示", JOptionPane.INFORMATION_MESSAGE);    }  }  /**   *  是否已经生成过中标通知书   * @return   */  private boolean isCreatedNotice(ZcEbNotice notice) {    Map paraMap = new HashMap();    paraMap.put("projCode", notice.getProjCode());    paraMap.put("packCode", notice.getPackCode());    int count = (Integer) zcEbBaseServiceDelegate.queryObject("ZcEbNotice.getNoticeCountByPackCode", paraMap, requestMeta);    if (count > 0) {      return true;    }    return false;  }  /**   *  是否已经生成过评审报告   * @return   */  private boolean isCreatedReport(ZcEbRfqPack bean) {    Map paraMap = new HashMap();    paraMap.put("projCode", bean.getProjCode());    paraMap.put("packCode", bean.getPackCode());    Object obj = zcEbBaseServiceDelegate.queryObject("ZcEbEval.getZcEbEvalReportByPackCode", paraMap, requestMeta);    if (obj != null) {      return true;    }    return false;  }  /**   *  是否已经生成过合同数据   * @return   */  private boolean isCreatedHt(ZcEbRfqPack bean) {    Integer count = (Integer) zcEbBaseServiceDelegate.queryObject("ZC_XMCG_HT.selectHtCountByPack", bean.getPackCode(), requestMeta);    if (count != null && count.intValue() > 0) {      return true;    }    return false;  }  /**   *  是否生成中标公告   * @return   */  private boolean isCreatedBul(ZcEbRfqPack bean) {    Map paraMap = new HashMap();    paraMap.put("projCode", bean.getProjCode());    paraMap.put("packCode", bean.getPackCode());    Object obj = zcEbBaseServiceDelegate.queryObject("ZcEbBulletin.getZcEbBulletinXunjiaWidBu", paraMap, requestMeta);    if (obj != null) {      return true;    }    return false;  }  /**   /**    * 插入中标通知书    * @return    */  private void insertNotice(ZcEbNotice notice, String fileID) {    notice.setFileID(fileID);    this.getZcEbNoticeServiceDelegate().insertFN(notice, requestMeta);  }  private ZcEbNotice createNotice() {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    ZcEbNotice notice = new ZcEbNotice();    notice.setExecutor(zcEbRfqPack.getCreator());    notice.setExecutorName(zcEbRfqPack.getManager());    notice.setInputorName(zcEbRfqPack.getInputorName());    notice.setAgency(zcEbRfqPack.getAgency());    notice.setNd(zcEbRfqPack.getNd());    notice.setNoticeStatus("0");    notice.setNoticeType("N");    notice.setOrgCode(zcEbRfqPack.getOrgCode());    notice.setProjCode(zcEbRfqPack.getProjCode());    notice.setProjName(zcEbRfqPack.getProjName());    notice.setPackCode(zcEbRfqPack.getPackCode());    notice.setPackName(zcEbRfqPack.getPackName());    notice.setNoticeName(zcEbRfqPack.getProjName() + "(" + zcEbRfqPack.getPackName() + ")中标通知书");    String noticeID = NumUtil.getNum("ZC_EB_NOTICE", "NOTICE_ID", notice, requestMeta);    notice.setNoticeID(noticeID);    notice.setProviderCode(zcEbRfqPack.getWinBidProviderCode());    notice.setProviderName(zcEbRfqPack.getWinBidProviderName());    notice.setInputorName(zcEbRfqPack.getInputorName());    notice.setExecuteDate(new Date());    return notice;  }  /**   * 填充word模版   * @param notice   * @return   */  private String fillWordMod(ZcEbNotice notice) throws Exception {    String templatename = "chengjiao_notice" + "_mod.ftl";    String wordFileName = "chengjiao_notice_mod.doc";    String fileID = AsOptionMeta.getOptVal("OPT_ZC_AUTO_NOTICE_FILE_ID");    String templateFilePath = WordFileUtil.getHtmlFileName("");    WordFileUtil.createFile(templateFilePath + "/" + templatename, fileID);    WordFileUtil.getFileContent(fileID);    Configuration configuration = new Configuration();    configuration.setDefaultEncoding("utf-8");    Map paraMap = new HashMap();    paraMap.put("projCode", notice.getProjCode());    paraMap.put("packCode", notice.getPackCode());    ZcEbBullietinZBTZ zcEbBullietinZBTZ = (ZcEbBullietinZBTZ) zcEbBaseServiceDelegate.queryObject("ZcEbNotice.getAutoNotice", paraMap, requestMeta);    FreemarkUtil.geneTempLateFile(templatename, zcEbBullietinZBTZ, templateFilePath + "/" + wordFileName, templateFilePath);    return templateFilePath + "/" + wordFileName;  }  /**   * 上传word文件   * @param fileName   * @return   */  private String saveBulletinContent(String fileName) {    String fileID = "";    fileID = WordFileUtil.uploadBulletinWordConstent(fileName);    return fileID;  }  /**   *    * @return 1:开标   0:审核   -1 废标   */  private int checkBaojiaInfo(boolean flag) {    BigDecimal bidP = null;    BigDecimal comp = null;    Date ghTime = null;    Date tbTime = null;    boolean ltMax = false;    ZcXunJiaSummary wner = null;    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    //标准设备或送审后开标    if (!"Y".equals(isCar) || flag) {      comp = zcEbRfqPack.getPackBudget();    } else {      comp = zcEbRfqPack.getPackMaxPrice();    }    for (int i = 0; i < this.xjSummaryList.size(); i++) {      if (xjSummaryList.get(i).getTotalPrice().compareTo(comp) <= 0) {        if (bidP == null          || xjSummaryList.get(i).getTotalPrice().compareTo(bidP) < 0          || (xjSummaryList.get(i).getTotalPrice().compareTo(bidP) == 0 && ghTime.after(xjSummaryList.get(i).getGongHuoDate()))          || (xjSummaryList.get(i).getTotalPrice().compareTo(bidP) == 0 && ghTime.equals(xjSummaryList.get(i).getGongHuoDate()) && tbTime            .after(tbDates.get(xjSummaryList.get(i).getProviderCode())))) {          bidP = xjSummaryList.get(i).getTotalPrice();          wner = xjSummaryList.get(i);          ghTime = xjSummaryList.get(i).getGongHuoDate();          tbTime = tbDates.get(xjSummaryList.get(i).getProviderCode());        }      } else if ("Y".equals(isCar) && xjSummaryList.get(i).getTotalPrice().compareTo(zcEbRfqPack.getPackBudget()) <= 0) {        ltMax = true;      }    }    if (bidP != null) {      wner.setIsClosedDeal("Y");      zcEbRfqPack.setWinBidProviderCode(wner.getProviderCode());      zcEbRfqPack.setWinBidProviderName(wner.getProviderName());      zcEbRfqPack.setWinBidSum(wner.getTotalPrice());      return 1;    } else if (ltMax && !flag) {      return 0;    }    return -1;  }  private void doRejectBid() {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    JTextField reason = new JTextField();    JLabel label = new JLabel();    Object[] message = { "请输入【废标】原因:", reason, label };    int num = this.getRejectReason(message, label, reason);    if (num == JOptionPane.YES_OPTION) {      this.pageStatus = ZcSettingConstants.PAGE_STATUS_EDIT;      zcEbRfqPack.setOpenBidStatus(ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_CRAP);      zcEbRfqPack.setStatus(ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_CRAP);      zcEbRfqPack.setIsGoonAudit(ZcSettingConstants.RFQ_AGREE_TRASH_BID);      zcEbRfqPack.setWinBidProviderCode(null);      zcEbRfqPack.setWinBidProviderName(null);      zcEbRfqPack.setWinBidSum(null);      try {        this.listPanel.zcEbRfqServiceDelegate.saveZcEbRfqPackFN(zcEbRfqPack, requestMeta);        this.listCursor.setCurrentObject(zcEbRfqPack);        this.refreshData(true);        this.listPanel.refreshCurrentTabData();        JOptionPane.showMessageDialog(this, "废标成功", "提示", JOptionPane.INFORMATION_MESSAGE);      } catch (Exception e) {        setEditingObject(oldZcEbRfqPack);        listCursor.setCurrentObject(oldZcEbRfqPack);        JOptionPane.showMessageDialog(this, "废标出错：\n" + e.getMessage(), "提示", JOptionPane.INFORMATION_MESSAGE);      }    } else {      return;    }  }  private int getRejectReason(Object[] message, JLabel label, JTextField reason) {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    int res = JOptionPane.showConfirmDialog(this, message, "确认【废标】吗？", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);    if (res == JOptionPane.OK_OPTION && reason.getText().trim().length() < 5) {      label.setText("原因太简单，请补充.");      res = this.getRejectReason(message, label, reason);    }    if (res == JOptionPane.OK_OPTION) {      zcEbRfqPack.setReason("【废标原因】" + reason.getText());      label.setText("");    }    return res;  }  private void doDelayBid() {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    JTextField reason = new JTextField();    JLabel label = new JLabel();    JDateTimeTextField delayDate = new JDateTimeTextField("", JDateTimeTextField.TimeTypeH24);    Object[] message = { "请输入【延期】原因:", reason, "延期后截止日期:", delayDate, label };    int num = getDelayReason(message, label, reason, delayDate);    if (num == JOptionPane.YES_OPTION) {      this.pageStatus = ZcSettingConstants.PAGE_STATUS_EDIT;      zcEbRfqPack.setOpenBidStatus(ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_DELAY);      this.listPanel.zcEbRfqServiceDelegate.updateZcEbRfqPackForDelay(zcEbRfqPack, requestMeta);      this.listCursor.setCurrentObject(zcEbRfqPack);      this.refreshData(false);      JOptionPane.showMessageDialog(this, "询价单延期处理成功，请重新发布询价延期公告...");      this.listPanel.refreshCurrentTabData();    } else {      return;    }  }  private int getDelayReason(Object[] message, JLabel label, JTextField reason, JDateTimeTextField date) {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    int res = JOptionPane.showConfirmDialog(this, message, "确认【延期】吗？", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);    if (res == JOptionPane.OK_OPTION && reason.getText().trim().length() < 5) {      label.setText("原因太简单，请补充.");      res = this.getDelayReason(message, label, reason, date);    }    if (res == JOptionPane.OK_OPTION && date.getDate() == null) {      label.setText("必须指定延期后的截止日期，请补充.");      res = this.getDelayReason(message, label, reason, date);    }    if (res == JOptionPane.OK_OPTION) {      zcEbRfqPack.setReason("【延期原因】" + reason.getText());      zcEbRfqPack.setReOpenBidDate(date.getDate());      zcEbRfqPack.setOpenBidDate(date.getDate());      zcEbRfqPack.setBidEndTime(date.getDate());      label.setText("");    }    return res;  }  public void doExit() {    this.parentWindow.dispose();  }  public boolean doSave() {    if (!checkBeforeSave()) {      return false;    }    return noCheckValueForSave(true);  }  /**   * 不校验，直接保存   */  private boolean noCheckValueForSave(boolean showMsgFlag) {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    boolean success = true;    String errorInfo = "";    //获取标段/检查开标状态、如果为0则更新为1    requestMeta.setFuncId(saveButton.getFuncId());    ZcEbRfqPack afterSaveBill = null;    try {      if ("".equals(ZcUtil.safeString(zcEbRfqPack.getRfqCode())) || zcEbRfqPack.getRfqCode().equals("自动编号")) {        afterSaveBill = this.listPanel.zcEbRfqServiceDelegate.saveZcEbRfqPackFN(zcEbRfqPack, requestMeta);      } else {        afterSaveBill = this.listPanel.zcEbRfqServiceDelegate.updateZcEbRfqPackFN(zcEbRfqPack, requestMeta);      }    } catch (Exception e) {      logger.error(e.getMessage(), e);      success = false;      errorInfo += e.getMessage();    }    if (success) {      if (showMsgFlag) {        JOptionPane.showMessageDialog(self, "保存成功！", "提示", JOptionPane.INFORMATION_MESSAGE);      }      this.pageStatus = ZcSettingConstants.PAGE_STATUS_BROWSE;      listCursor.setCurrentObject(afterSaveBill);      refreshData(true);      this.listPanel.refreshCurrentTabData();      return true;    } else {      JOptionPane.showMessageDialog(this, "保存失败 ！\n" + errorInfo, "错误", JOptionPane.ERROR_MESSAGE);      return false;    }  }  private void doTrace() {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    if (zcEbRfqPack == null) {      return;    }    ZcUtil.showTraceDialog(zcEbRfqPack, compoId);  }  private boolean checkBeforeSave() {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    StringBuilder errorInfo = new StringBuilder();    if (ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_SUCCESS.equals(zcEbRfqPack.getOpenBidStatus())) {      if (zcEbRfqPack.getWinBidProviderName() == null) {        errorInfo.append("请选择中标供应商");      }      if (ZcSettingConstants.XUNJIA_STATUS_OPEN_BID_SUCCESS.equals(zcEbRfqPack.getOpenBidStatus())        && (rfqTeamArea.getText() == null || "".equals(rfqTeamArea.getText().trim()))) {        /* int sel = JOptionPane.showConfirmDialog(this.parentWindow, "您没有填写【询价小组意见】，是否继续？", "提示", JOptionPane.YES_NO_OPTION,           JOptionPane.WARNING_MESSAGE);         if (sel == JOptionPane.NO_OPTION) {           return false;         }*/      } else if (rfqTeamArea.getText() != null) {        zcEbRfqPack.setRfqTeamOpinion(rfqTeamArea.getText().trim());      }    }    if (errorInfo.length() != 0) {      JOptionPane.showMessageDialog(this.parentWindow, errorInfo.toString(), "提示", JOptionPane.WARNING_MESSAGE);      return false;    }    return true;  }  private void doXunJiaTotalPrintPrevie() {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    //打印前是否保存校验    if (!isDataChanged()) {    } else {      doSave();    }    this.requestMeta.setFuncId(this.xunJiaTotalPrintPreviewButton.getFuncId());    this.requestMeta.setPageType(this.compoId + "_L");    try {      String projCode = zcEbRfqPack.getProjCode();      String packCode = zcEbRfqPack.getPackCode();      int nd = zcEbRfqPack.getNd() == 0 ? requestMeta.getSvNd() : zcEbRfqPack.getNd();      String url = WorkEnv.getInstance().getWebRoot() + "app/page/xjprint/toXunJiaTotalPrint.do?projCode=" + projCode + "&packCode=" + packCode      + "&nd=" + nd;      ZcUtil.anyBrowse(url);    } catch (Exception e) {      logger.error(e.getMessage(), e);      JOptionPane.showMessageDialog(this, "打印预览出错！\n" + e.getMessage(), "错误", 0);    }  }  private void doXunJiaDetailPrintPrevie() {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    this.requestMeta.setFuncId(this.xunJiaTotalPrintPreviewButton.getFuncId());    this.requestMeta.setPageType(this.compoId + "_L");    try {      String projCode = zcEbRfqPack.getProjCode();      String packCode = zcEbRfqPack.getPackCode();      int nd = zcEbRfqPack.getNd() == 0 ? requestMeta.getSvNd() : zcEbRfqPack.getNd();      String url = WorkEnv.getInstance().getWebRoot() + "app/page/xjprint/toXunJiaDetailPrint.do?projCode=" + projCode + "&packCode=" + packCode      + "&nd=" + nd;      ZcUtil.anyBrowse(url);    } catch (Exception e) {      logger.error(e.getMessage(), e);      JOptionPane.showMessageDialog(this, "打印预览出错！\n" + e.getMessage(), "错误", 0);    }  }  private void doCreateEval() {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    List list = new ArrayList();    BillElementMeta billElementMeta = BillElementMeta.getBillElementMetaWithoutNd("ZC_EB_EVAL_REPORT");    Map paraMap = new HashMap();    paraMap.put("projCode", zcEbRfqPack.getProjCode());    paraMap.put("packCode", zcEbRfqPack.getPackCode());    ZcEbEvalReport report = (ZcEbEvalReport) zcEbBaseServiceDelegate.queryObject("ZcEbEval.getZcEbEvalReportByPackCode", paraMap, requestMeta);    if (report == null) {      new ZcEbReportDialog(this.listPanel.getParentWindow(), list, 0, "draft", billElementMeta, getProj(), zcEbRfqPack);    } else {      list.add(report);      new ZcEbReportDialog(this.listPanel.getParentWindow(), list, 0, "all", billElementMeta, getProj(), zcEbRfqPack);    }  }  private ZcEbProj getProj() {    // TODO Auto-generated method stub    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    return this.zcEbProjectServiceDelegate.getZcEbProjByProjCode(zcEbRfqPack.getProjCode(), requestMeta);  }  private void doCreateBulW() {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    if (isCreatedBul(zcEbRfqPack)) {      JOptionPane.showMessageDialog(this, "已经生成成交结果!不需要重复生成！", "提示", JOptionPane.INFORMATION_MESSAGE);      return;    }    ZcBulWModel mod = listPanel.zcEbRfqServiceDelegate.findBulWModel(zcEbRfqPack.getProjCode(), zcEbRfqPack.getPackCode(), requestMeta);    if (mod == null) {      JOptionPane.showMessageDialog(this, "没有找到该项目中标结果公告数据！\n", "错误", JOptionPane.ERROR_MESSAGE);      return;    }    if (mod.getFile() == null || mod.getFile().getFileContent() == null || mod.getFile().getFileContent().length == 0) {      JOptionPane.showMessageDialog(this, "没有找到中标结果公告模板！\n", "错误", JOptionPane.ERROR_MESSAGE);    }    if (xjSummaryList != null) {      for (int i = 0; i < xjSummaryList.size(); i++) {        if ("Y".equals(xjSummaryList.get(i).getIsClosedDeal())) {          mod.setGonghDate(ds.format(xjSummaryList.get(i).getGongHuoDate()));          List dts = xjSummaryList.get(i).getXunJiaDetailList();          if (dts == null) {            break;          }          StringBuffer sb = new StringBuffer();          for (int j = 0; j < dts.size(); j++) {            ZcXunJiaDetail dt = (ZcXunJiaDetail) dts.get(j);            sb.append(dt.getSpName()).append("(数量:").append(dt.getSpNum()).append(")、");          }          if (sb.length() > 0) {            mod.setContent(sb.substring(0, sb.length() - 1));          }        }      }    }    createModel(mod.getFile(), mod, zcEbRfqPack.getProjCode() + "-" + zcEbRfqPack.getPackName() + ZcSettingConstants.ZC_JB_BUL_W_MODEL_FILE_NAME);    String fileId = saveAsFile(mod.getFile());    try {      Map<String, String> map = new HashMap<String, String>();      map.put("packCode", zcEbRfqPack.getPackCode());      map.put("projCode", zcEbRfqPack.getProjCode());      map.put("modCode", mod.getModCode());      map.put("modName", mod.getModName());      map.put("coCode", zcEbRfqPack.getCoCode());      map.put("projName", zcEbRfqPack.getProjName());      listPanel.zcEbRfqServiceDelegate.createBulW(map, fileId, requestMeta);      JOptionPane.showMessageDialog(this, "成功生成中标结果公告！", "提示", JOptionPane.INFORMATION_MESSAGE);    } catch (Exception e) {      JOptionPane.showMessageDialog(this, "生成中标结果公告失败！\n" + e.getMessage(), "错误", JOptionPane.ERROR_MESSAGE);    }  }  private void doCreateHt() {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    if (isCreatedHt(zcEbRfqPack)) {      JOptionPane.showMessageDialog(this, "已经生成过合同了!不需要重复生成！", "提示", JOptionPane.INFORMATION_MESSAGE);      return;    }    ZcHtModel mod = listPanel.zcEbRfqServiceDelegate.findHtModel(zcEbRfqPack.getProjCode(), zcEbRfqPack.getPackCode(), requestMeta);    if (mod == null) {      JOptionPane.showMessageDialog(this, "没有找到该项目合同数据！\n", "错误", JOptionPane.ERROR_MESSAGE);    }    if (mod.getFile() == null || mod.getFile().getFileContent() == null || mod.getFile().getFileContent().length == 0) {      JOptionPane.showMessageDialog(this, "没有找到合同模板！\n", "错误", JOptionPane.ERROR_MESSAGE);    }    BigDecimal sum = BigDecimal.ZERO;    if (mod.getItem() != null && mod.getItem().size() > 0) {      mod.setZcDeliveryDate(ds.format(((SupplierPriceDetail) mod.getItem().get(0)).getGongHuoDate()));      for (int i = 0; i < mod.getItem().size(); i++) {        SupplierPriceDetail d = (SupplierPriceDetail) mod.getItem().get(i);        d.setProdName(StringUtil.freeMarkFillWordChar(d.getProdName()));        d.setProdBrand(StringUtil.freeMarkFillWordChar(d.getProdBrand()));        d.setProdType(StringUtil.freeMarkFillWordChar(d.getProdType()));        d.setProdMainParam(StringUtil.freeMarkFillWordChar(d.getProdMainParam()));        sum = sum.add(d.getProdSumPrice());      }    }    mod.setZcHtNum(sum.toString());    mod.setZcHtNumUpp(ChangeRMB.doChange(sum.toString()));    createModel(mod.getFile(), mod, zcEbRfqPack.getProjCode() + "-" + zcEbRfqPack.getPackName() + ZcSettingConstants.ZC_JB_HT_MODEL_FILE_NAME);    String fileId = saveAsFile(mod.getFile());    try {      ZcXmcgHt ht = new ZcXmcgHt();      ht.setZcHtCode(mod.getZcHtCode());      ht.setAgency("900");      ht.setZcHtName(zcEbRfqPack.getProjName());      ht.setZcHtType("1");      ht.setZcMakeCode(zcEbRfqPack.getProjCode());      ht.setZcBidCode(zcEbRfqPack.getPackCode());      ht.setCoCode(zcEbRfqPack.getCoCode());      ht.setNd(requestMeta.getSvNd());      ht.setZcSgnDate(requestMeta.getSysDate());      ht.setZcSuName(mod.getZcSuName());      ht.setZcHtNum(sum);      ht.setZcFukuanType("1");      ht.setZcHtStatus("0");      ht.setExecutor(requestMeta.getSvUserID());      ht.setExecuteDate(new Date());      ht.setZcInputCode(ht.getExecutor());      ht.setZcInputDate(ht.getExecuteDate());      ht.setZcSuLinkman(mod.getLinkMan());      ht.setZcZbName(mod.getZcSuName());      ht.setZcCgLeixing("Z01");      ht.setZcBidContent(zcEbRfqPack.getProjName());      ht.setZcDeliveryDate(mod.getZcDeliveryDate());      ht.setZcDeliveryAddr("供方店内");      ht.setZcDeliveryType("需方凭本合同向供方提车");      ht.setOrgCode(requestMeta.getSvOrgCode());      ht.setZcConTextBlobid(fileId);      if (xjSummaryList != null) {        for (int i = 0; i < xjSummaryList.size(); i++) {          if ("Y".equals(xjSummaryList.get(i).getIsClosedDeal())) {            ht.setZcSuCode(xjSummaryList.get(i).getProviderCode());            ht.setZcZbCode(xjSummaryList.get(i).getProviderCode());          }        }      }      listPanel.zcEbRfqServiceDelegate.createHt(ht, requestMeta);      JOptionPane.showMessageDialog(this, "成功生成合同！", "提示", JOptionPane.INFORMATION_MESSAGE);    } catch (Exception e) {      JOptionPane.showMessageDialog(this, "生成合同失败！\n" + e.getMessage(), "错误", JOptionPane.ERROR_MESSAGE);    }  }  private void createModel(AsFile file, Object mod, String actFileId) {    String PATH = ZcUtil.dir + "md/";    file.setFileName(PATH + actFileId + ".doc");    String modname = actFileId + "_mod.doc";    // 创建临时文件    boolean isSucceed = WordFileUtil.createFile(PATH, PATH + modname, this, file.getFileContent());    File f = new File(PATH);    Configuration configuration = new Configuration();    configuration.setDefaultEncoding("utf-8");    OutputStream out = null;    Writer writer = null;    try {      configuration.setDirectoryForTemplateLoading(f);      Template template = configuration.getTemplate(modname);      out = new FileOutputStream(file.getFileName());      writer = new BufferedWriter(new OutputStreamWriter(out, "utf-8"));      template.process(mod, writer);      writer.flush();    } catch (Exception e) {      // TODO Auto-generated catch block      e.printStackTrace();    } finally {      try {        if (writer != null) {          writer.close();        }        if (out != null) {          out.close();        }      } catch (IOException e) {      }    }  }  private String saveAsFile(AsFile file) {    String fileID = "";    if (file == null)      return null;    String fileName = file.getFileName();    if (fileName != null && fileName.length() != 0)      fileID = WordFileUtil.uploadBulletinWordConstent(fileName);    return fileID;  }  public boolean isDataChanged() {    ZcEbRfqPack zcEbRfqPack = (ZcEbRfqPack) this.listCursor.getCurrentObject();    if (null != rfqTeamArea.getText() && !"".equals(rfqTeamArea.getText())) {      zcEbRfqPack.setRfqTeamOpinion(rfqTeamArea.getText());    }    return !DigestUtil.digest(oldZcEbRfqPack).equals(DigestUtil.digest(zcEbRfqPack));  }  public Window getParentWindow() {    return parentWindow;  }  public void setParentWindow(Window parentWindow) {    this.parentWindow = parentWindow;  }  public IZcEbNoticeServiceDelegate getZcEbNoticeServiceDelegate() {    return zcEbNoticeServiceDelegate;  }}